package com.base.cn.platform.os.controller.qa;

import com.base.cn.platform.os.controller.cmmon.ApiBaseController;
import com.base.cn.platform.os.service.course.qa.qaadd.QaAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;


/**
 * 问答追问Controller接口
 *
 * @author s.li
 * @create 2018-09-06-19:16
 */
@RestController
@RequestMapping("/api/qa")
public class ApiQuestionAddController extends ApiBaseController {

    @Autowired
    private QaAddService qaAddService;

    /**
     * 添加问答追问
     * @param questionId 问答ID
     * @param addContext 追问内容
     * @param userId 用户ID
     * @return Map<String,Object>
     */
    @RequestMapping("/saveQuestionAdd")
    public Map<String,Object> saveQuestionAdd(@RequestParam("questionId") BigDecimal questionId,
                                              @RequestParam("addContext") String addContext,
                                              @RequestParam("userId") BigDecimal userId){
        Map<String,Object> qaAdd = new HashMap<>();
        qaAdd.put("questionId",questionId);
        qaAdd.put("addContext",addContext);
        return qaAddService.saveQuestionAdd(qaAdd,userId);
    }
}
